<?php

namespace Home\Controller;
use Home\Common\CommonController;

/**
 * 网站新动态
 */

class IndexController extends CommonController{
    public function index(){

    	$modle = M('user');

		$this->display();
	
    }

     public function index_ajax(){

  		//$sql = "UPDATE `user` SET `index` = `index`+'1' where `id` = '{$_SESSION['id']}'";
		// $modle = M('question');

		// $result = $modle -> execute($sql);

		// $sql = "SELECT * FROM `question` LEFT JOIN `` ";

		// $result = $modle -> query($sql);
	
    }
    public function search()
    {
    	if(IS_POST){

            $q = I('post.q','');

            $sql = "select * from question where ";

            $cn = '';

            $res = Cut($q);

            foreach ($res as  $row) {
                $sql .= $cn."title like '%".$row['word']."%'";
                $cn = " or ";
            }

    		$data = M()->query($sql);
    		var_dump($data);
    	}else{
    		$this->error('请输入你想要的词');
    	}
    	
    }

}


?>